﻿using FluentValidation;
using FikriKibar.Entities.Composite.BaseModels;
using FikriKibar.Entities.Concrete;
using FikriKibar.Globalization;

namespace FikriKibar.Common.Validation.FluentValidation.Setting
{
    public class UpdateRules : AbstractValidator<UpdateModel<SettingLanguageLine>>
    {
        public UpdateRules()
        {
            RuleFor(p => p.Item.SettingName).NotEmpty().WithMessage(Resources.NameNotEmpty);
            RuleFor(p => p.Item.SettingName).Length(2, 100).WithMessage(Resources.NameLength);

            RuleFor(p => p.Item.Setting.SettingKey).NotEmpty().WithMessage(Resources.KeyNotEmpty);
            RuleFor(p => p.Item.Setting.SettingKey).Length(2, 100).WithMessage(Resources.KeyLength);

            RuleFor(p => p.Item.Setting.SettingValue).NotEmpty().WithMessage(Resources.ValueNotEmpty);
            RuleFor(p => p.Item.Setting.SettingValue).Length(1, 100).WithMessage(Resources.ValueLength);
        }
    }
}
